const util = require('./utils/util.js')
const ajax = require('./utils/ajax/ajax.js')
App({
  onLaunch() {
    util.showLoading('加载中...')
    wx.login({
      success(res) {
        if (res.code) {
          ajax.post({
            url: '/wx/getOpenid',
            data: {
              js_code: res.code
            },
            success(res) {
              wx.setStorageSync('openid', res.data.openid)
            },
            complete() {
              util.hideLoading()
            }
          })
        }
      }
    })
  },

  globalData: {

  }
})